{extend name="base/base" /}
{block name="style"}
<style type="text/css">

</style>
{/block}
{block name="content"}
<div class="layui-form-item layui-form-pane">
      <div class="layui-inline">
        <label class="layui-form-label">用户ID</label>
          <div class="layui-input-inline">
            <input type="text" name="uid" autocomplete="off" class="layui-input" id='uid'>
          </div>
      </div>
      <div class="layui-inline">
          <label class="layui-form-label">用户名</label>
          <div class="layui-input-inline">
              <input type="text" name="username" autocomplete="off" class="layui-input" id='username'>
          </div>
      </div>
      <div class="layui-inline">
        <div class="demoTable">
          <button class="layui-btn" data-type="reload">搜索</button>
        </div>
      </div>
        <table id="table" lay-filter="table"></table> 
</div>
{/block}
{block name="script"}
<script>
layui.use('table', function(){
  var table = layui.table; 
  table.render({
  elem: '#table'
  ,height: 'full-150'
  ,url: '/admin/exchange/exchangeList/' //数据接口
  ,limit:20
  ,page: true //开启分页
  ,id:'reload'
  ,cols: [[ //表头
        {field:'uid', title: '用户ID', width: 100 }
      ,{field:'username', title: '用户名', width: 200 }
      ,{field:'name', title: '兑出钱包', width: 200}
      ,{field:'amount', title: '兑换数量(美金)', width: 200}
      ,{field:'fee', title: '手续费', width: 200}
      ,{field:'to_name', title: '兑入钱包', width: 200}   
      ,{field:'to_amount', title: '兑入数量', width: 200}
     // ,{field:'left_coin', title: '兑换后结余(到代币账户)', width: 200}
     ,{field:'date', title: '兑换时间', width: 200}
    ]]
  }); 
    // 搜索
  var $ = layui.$, active = {
        reload: function(){
            table.reload('reload', {
                where: {
                    uid: $('#uid').val(),
                    username: $('#username').val(),
                }
            });
        }
    };
    $('.demoTable .layui-btn').on('click', function(){
    var type = $(this).data('type');
    active[type] ? active[type].call(this) : '';
  });
});
</script>
{/block}
